package com.mac.bio;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Description
 * @auther machuan
 * @create 2020-04-17 14:34
 */
public class SocketClient {
    public static void main(String[] args) throws Exception {
//        String msg = "我是客户端";
        Socket cli = new Socket("127.0.0.1", 8089);
        Scanner sc=new Scanner(System.in);
        PrintWriter pw = new PrintWriter(cli.getOutputStream());
        BufferedReader br = new BufferedReader(new InputStreamReader(cli.getInputStream()));
        pw.write(sc.next());
        pw.flush();
        cli.shutdownOutput();
        String line = br.readLine();
        System.out.println("收到服务端信息：" + line);
        pw.close();
        br.close();
        cli.close();
    }
}
